<?php



namespace Ptxq\Controller;
use Common\Controller\HomebaseController;
class IndexController extends HomebaseController{
    function index(){
    	if($_GET){
    		$id=I('id');
			$Ptxq=M("Ptxq");
			$result=$Ptxq->where(array('id'=>$id))->select();
			$tuijian=$Ptxq->where(array('tuijian'=>1))->limit(8)->select();
			
			//获取交易品种
			$jypz=M("jypz");
			$jy_pz=$jypz->table('cmf_pt_pz ptpz, cmf_jypz jypz')->where('ptpz.pt_id = '.$id.' and ptpz.pz_id =jypz.id')->select();
			$jypzsx=M("jypzsx");
			foreach($jy_pz as $k=>$v){
				$rs=$jypzsx->where(array('jypz_id'=>$v['pz_id']))->order('sort asc')->select();
				$jy_pz[$k]['sx']=$rs;
			}
		
		//获取开户银行
		
		$pt_yh=M("pt_yh");
		foreach($result as $k=>$v){
			$rs=$pt_yh->where(array('pt_id'=>$v['id']))->select();
			$rs=$pt_yh->table('cmf_pt_yh ptyh, cmf_khyh khyh')->where('ptyh.pt_id = '.$id.' and ptyh.yh_id =khyh.id')->field('ptyh.*,khyh.name,khyh.yh_img')->select();
			$result[$k]['child']=$rs;
		}
		$this->assign('tuijian',$tuijian);
		$this->assign('jypz',$jy_pz);
		$this->assign('ptxq',$result['0']);
	 	$this->display(":index");
    		
    	}else{
    	
			$this->error("页面错误");
    	}
	 	
	  
    }
}